﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;

namespace YAPL.Util {
	public static class Executor {
		public static string GetProgramOutput(string programName,params string[] parameters) {
			var procStartInfo = new ProcessStartInfo(programName, string.Join(" ",parameters)) {
				UseShellExecute = false,
				CreateNoWindow = true,
				RedirectStandardOutput = true
			};

			var verifyProcess = new Process { StartInfo = procStartInfo };
			verifyProcess.Start();

			var outputReader = verifyProcess.StandardOutput;
			var output = outputReader.ReadToEnd();
			return Encoding.Default.DecodeString(output, Encoding.GetEncoding(866));
		}
	}
}
